package com.wlk.controller;

import com.wlk.pojo.dto.AddReimbDTO;
import com.wlk.pojo.dto.ReimbVerifyDTO;
import com.wlk.service.ReimbService;
import com.wlk.utils.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/reimb")
public class ReimbController {
    @Resource
    private ReimbService reimbService;

    /**
     * @description: 提交报销单入口
     * @author:
     * @date: 2024/6/18 下午4:12
     * @param:
     * @return:
     **/
    @PostMapping("/add")
    public Result addReimb(@RequestBody AddReimbDTO addReimbDTO){
        return reimbService.addReimb(addReimbDTO);
    }

    /**
     * @description: 获取报销单列表入口
     * @author:
     * @date: 2024/6/18 下午5:19
     * @param:
     * @return:
     **/
    @GetMapping("/list")
    public Result getReimbList(){
        return reimbService.getReimbList();
    }

    /**
     * @description: 根据填报人id获取报销单列表入口
     * @author:
     * @date: 2024/6/18 下午8:51
     * @param:
     * @return:
     **/
    @GetMapping("/getReimbListByApplicantId/{userId}")
    public Result getReimbListByApplicantId(@PathVariable("userId")Integer userId){
        return reimbService.getReimbListByApplicantId(userId);
    }

    /**
     * @description: 审核入口
     * @author:
     * @date: 2024/6/19 上午9:42
     * @param:
     * @return:
     **/
    @PostMapping("/verify")
    public Result verifyReimb(@RequestBody ReimbVerifyDTO reimbVerifyDTO){
        return reimbService.updateStatusByVerifier(reimbVerifyDTO);
    }

    /**
     * @description: 获取待审核报销单列表入口
     * @author:
     * @date: 2024/6/19 下午4:14
     * @param:
     * @return:
     **/
    @GetMapping("/getPendingReimbList")
    public Result getPendingReimbList(){
        return reimbService.getPendingReimbList();
    }
@GetMapping("/getZzst")
    public Result getZzst(){
        return reimbService.getZzst();
    }

}
